package com.prs.crm.domain.doc;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.Cascade;

import com.prs.crm.domain.BaseEntity;
import com.prs.crm.domain.hr.Person;
import com.prs.crm.domain.hr.Resume;
import com.prs.crm.domain.sale.ReturnsDetail;
@Entity
@Table(name="doc_docTaskSend")
/**
 * 发送任务实体
 * 
 */
public class DocTaskSend extends BaseEntity {

	private static final long serialVersionUID = -8148256415530888431L;
	
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	private Integer id;
	
	@ManyToOne
	private Resume resume;
	
	@OneToMany(mappedBy = "docTaskSend")
	@Cascade( { org.hibernate.annotations.CascadeType.ALL,
			org.hibernate.annotations.CascadeType.DELETE_ORPHAN })
	private Set<DocSendWork> docSendWork;
	
	@ManyToOne
	private Person receivePerson;
	
	private Date startTime;
	
	private Date endTime;
	
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	public Person getReceivePerson() {
		return receivePerson;
	}
	public void setReceivePerson(Person receivePerson) {
		this.receivePerson = receivePerson;
	}
	public Date getStartTime() {
		return startTime;
	}
	public void setStartTime(Date startTime) {
		this.startTime = startTime;
	}
	public Date getEndTime() {
		return endTime;
	}
	public void setEndTime(Date endTime) {
		this.endTime = endTime;
	}
	public Resume getResume() {
		return resume;
	}
	public void setResume(Resume resume) {
		this.resume = resume;
	}
	public Set<DocSendWork> getDocSendWork() {
		return docSendWork;
	}
	public void setDocSendWork(Set<DocSendWork> docSendWork) {
		this.docSendWork = docSendWork;
	}
	
	public void addDetail(DocSendWork detail) {
		if (docSendWork == null)
			docSendWork = new HashSet<DocSendWork>();
		detail.setDocTaskSend(this);
		docSendWork.add(detail);
	}
}

